import java.awt.Point;
import java.util.ArrayList;

public class ConsoleController implements Controller {
	
	private ConsoleState model;
	private ConsoleView view;
	private DataControl data;
	
	public static void main(String [] args)
	{
		new ConsoleController();
	}
	
	
	
	public ConsoleController()
	{
		model = new ConsoleState();
		data=new DataControl();
		view = new ConsoleView(this, "Efficiency Tester (aka E.T.)");
		view.setVisible(true);
	}
	
	public void dealWithInfo(int maxSize, int interval)
	{
		InfoAnalysis info=new InfoAnalysis(this);
		info.setMaxSize(maxSize);
		info.setInterval(interval);
		info.generateDataSet(model.getOptionsPicked());
	}
	
	public String[] getNextMenu(String selected, int depth)
	{
		model.updateDepth(depth);
		String[] output = model.access(selected);
		return output;
	}
	
	public void addDataSet(ArrayList<Long> newData)
	{
		data.addDataSet(newData);
		data.updateOptionsPicked(getOptionsPicked());
	}
	
	public ArrayList<ArrayList<Point>> getData() 
	{
		return data.getDataForGraph();	
	}
	
	public int getLargestData()
	{
		return data.getLargestData();
	}
	
	public int getLargestSize()
	{
		return data.getLargestSize();
	}
	@Override
	public ArrayList<String> getOptionsPicked() {
		// TODO Auto-generated method stub
		return model.getOptionsPicked();
	}

	@Override
	public void clearData() 
	{
		data.clearData();
	}
	
	public void removeData(int which)
	{
		data.removeData(which);
	}
	
	public String[] accessNoUpdate(String s)
	{
		return model.accessNoUpdate(s);
	}

	@Override
	public ArrayList<String> getLabels() {
		if (data.getPickedHistory()==null)
		{
			return new ArrayList<String>();
		}
		return data.getPickedHistory();
	}
}